package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.LTruckMapper;
import com.ruoyi.system.domain.LTruck;
import com.ruoyi.system.service.ILTruckService;

import static com.ruoyi.common.utils.SecurityUtils.getUserId;

/**
 * 车辆Service业务层处理
 *
 * @author zyb
 * @date 2022-01-02
 */
@Service
public class LTruckServiceImpl extends ServiceImpl<LTruckMapper, LTruck> implements ILTruckService {

    /**
     * 查询车辆
     *
     * @param tid 车辆主键
     * @return 车辆
     */
    @Override
    public LTruck selectLTruckByTid(Long tid) {
        return baseMapper.selectLTruckByTid(tid);
    }

    /**
     * 查询车辆列表
     *
     * @param lTruck 车辆
     * @return 车辆
     */
    @Override
    public List<LTruck> selectLTruckList(LTruck lTruck) {
        return baseMapper.selectLTruckList(lTruck);
    }

    /**
     * 新增车辆
     *
     * @param lTruck 车辆
     * @return 结果
     */
    @Override
    public int insertLTruck(LTruck lTruck) {
        lTruck.setCreateBy(String.valueOf(getUserId()));
        lTruck.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLTruck(lTruck);
    }

    /**
     * 修改车辆
     *
     * @param lTruck 车辆
     * @return 结果
     */
    @Override
    public int updateLTruck(LTruck lTruck) {
        lTruck.setUpdateBy(String.valueOf(getUserId()));
        lTruck.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateLTruck(lTruck);
    }

    /**
     * 批量删除车辆
     *
     * @param tids 需要删除的车辆主键
     * @return 结果
     */
    @Override
    public int deleteLTruckByTids(Long[] tids) {
        return baseMapper.deleteLTruckByTids(tids);
    }

    /**
     * 删除车辆信息
     *
     * @param tid 车辆主键
     * @return 结果
     */
    @Override
    public int deleteLTruckByTid(Long tid) {
        return baseMapper.deleteLTruckByTid(tid);
    }
}
